/**
 * Copyright (c) 2010, QinJian
 * All rights reserved.
 */
package com.q.course.dao.category;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.q.course.entity.category.Category;

/**
 * @author 覃健,Email:j411@qq.com
 *
 */
public interface CategoryDao extends PagingAndSortingRepository<Category, Long> {

	List<Category> findByTypeAndExistState( long type , boolean b );
	List<Category> findByTypeAndCategoryIdAndExistState( long type , Long categoryId, boolean b );
	
	@Query("select c.courseId from Classes c where c.existState=1 and c.id=?1")
	Long getCourseByClass( Long classId );
	
	List<Category> findByIdOrCategoryIdAndExistState( Long cid, Long cpid, boolean b );
}
